﻿using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using Autodesk.Revit.DB;
using YArchitech.Controls;
using YArchitech.LIB;
using YArchitech.LIB.YJKControls;
using YJKBatchPrinter.Properties;
using YJKBatchPrinter.Utils;

namespace YJKBatchPrinter
{
	public partial class PrintSetupForm : System.Windows.Forms.Form
	{
		public PrintSetupForm(PrintSTP printSetup)
		{
			this.m_printSetup = printSetup;
			this.InitializeComponent();
		}

		private void PrintSetupForm_Load(object sender, EventArgs e)
		{
			this.ReadData();
			//base.Icon = Resource.YArchitechIcon;
			this.printerNameLabel.Text = this.m_printSetup.PrinterName;
			this.printSetupsComboBox.DataSource = this.m_printSetup.PrintSettingNames;
			this.printSetupsComboBox.SelectedValueChanged += this.printSetupsComboBox_SelectedValueChanged;
			this.printSetupsComboBox.SelectedItem = this.m_printSetup.SettingName;
			if (PrintSetupForm.m_RcdSetting == null)
			{
				PrintSetupForm.m_RcdSetting = new PrintSetupForm.printSettingDlg();
				PrintParameters printParameters = this.m_printSetup.getRvtPrintManger().PrintSetup.CurrentPrintSetting.PrintParameters;
				PrintSetupForm.m_RcdSetting.reSetValues(printParameters);
			}
			this.renameButton.Enabled = (this.deleteButton.Enabled = (this.m_printSetup.SettingName.Equals("<在任务中>") ? false : true));
			this.paperSizeComboBox.DataSource = this.m_printSetup.PaperSizes;
			this.paperSizeComboBox.SelectedItem = this.m_printSetup.PaperSize;
			this.paperSizeComboBox.SelectedValueChanged += this.sizeComboBox_SelectedValueChanged;
			this.paperSourceComboBox.DataSource = this.m_printSetup.PaperSources;
			this.paperSourceComboBox.SelectedItem = this.m_printSetup.PaperSource;
			this.paperSourceComboBox.SelectedValueChanged += this.sourceComboBox_SelectedValueChanged;
			this.landscapeRadioButton.CheckedChanged += this.landscapeRadioButton_CheckedChanged;
			this.portraitRadioButton.CheckedChanged += this.portraitRadioButton_CheckedChanged;
            if ((int)this.m_printSetup.PageOrientation == 1)
			{
				this.landscapeRadioButton.Checked = true;
			}
			else
			{
				this.portraitRadioButton.Checked = true;
			}
			this.marginTypeComboBox.DataSource = this.m_printSetup.MarginTypesStr;
			this.offsetRadioButton.CheckedChanged += this.offsetRadioButton_CheckedChanged;
			this.centerRadioButton.CheckedChanged += this.centerRadioButton_CheckedChanged;
			this.userDefinedMarginYTextBox.TextChanged += this.userDefinedMarginYTextBox_TextChanged;
			this.userDefinedMarginXTextBox.TextChanged += this.userDefinedMarginXTextBox_TextChanged;
			this.marginTypeComboBox.SelectedValueChanged += this.marginTypeComboBox_SelectedValueChanged;
			this.marginTypeComboBox.SelectedItem = this.m_printSetup.SelectedMarginType;
			if (this.m_printSetup.PaperPlacement == null)
			{
				this.centerRadioButton.Checked = true;
				this.offsetRadioButton.Checked = false;
			}
			else
			{
				this.offsetRadioButton.Checked = true;
				this.centerRadioButton.Checked = false;
			}
			this.rasterRadioButton.CheckedChanged += this.rasterRadioButton_CheckedChanged;
			this.vectorRadioButton.CheckedChanged += this.vectorRadioButton_CheckedChanged;
            if (this.m_printSetup.HiddenLineViews == (HiddenLineViewsType)1)
			{
				this.rasterRadioButton.Checked = true;
			}
			else
			{
				this.vectorRadioButton.Checked = true;
			}
			this.zoomRadioButton.CheckedChanged += this.zoomRadioButton_CheckedChanged;
            if (this.m_printSetup.ZoomType == (ZoomType)1)
			{
				this.zoomRadioButton.Checked = true;
				this.zoomPercentNumericUpDown.Value = this.m_printSetup.Zoom;
			}
			else
			{
				this.fitToPageRadioButton.Checked = true;
			}
			this.fitToPageRadioButton.CheckedChanged += this.fitToPageRadioButton_CheckedChanged;
			this.rasterQualityComboBox.DataSource = this.m_printSetup.RasterQualitiesStr;
			this.rasterQualityComboBox.SelectedItem = this.m_printSetup.RasterQualityTypeToStr(this.m_printSetup.RasterQuality);
			this.rasterQualityComboBox.SelectedValueChanged += this.rasterQualityComboBox_SelectedValueChanged;
			this.colorsComboBox.DataSource = this.m_printSetup.ColorsStr;
			this.colorsComboBox.SelectedValueChanged += this.colorsComboBox_SelectedValueChanged;
			this.colorsComboBox.SelectedItem = this.m_printSetup.colorTypeToStr(this.m_printSetup.Color);
			this.ViewLinksInBlueCheckBox.CheckedChanged += this.ViewLinksInBlueCheckBox_CheckedChanged;
			this.ViewLinksInBlueCheckBox.Checked = this.m_printSetup.ViewLinksinBlue;
			this.hideScopeBoxedCheckBox.CheckedChanged += this.hideScopeBoxedCheckBox_CheckedChanged;
			this.hideScopeBoxedCheckBox.Checked = this.m_printSetup.HideScopeBoxes;
			this.hideRefWorkPlanesCheckBox.CheckedChanged += this.hideRefWorkPlanesCheckBox_CheckedChanged;
			this.hideRefWorkPlanesCheckBox.Checked = this.m_printSetup.HideReforWorkPlanes;
			this.hideCropBoundariesCheckBox.CheckedChanged += this.hideCropBoundariesCheckBox_CheckedChanged;
			this.hideCropBoundariesCheckBox.Checked = this.m_printSetup.HideCropBoundaries;
			this.hideUnreferencedViewTagsCheckBox.CheckedChanged += this.hideUnreferencedViewTagsCheckBox_CheckedChanged;
			this.hideUnreferencedViewTagsCheckBox.Checked = this.m_printSetup.HideUnreferencedViewTags;
			this.halfToLinecheckBox.CheckedChanged += this.halfToLinecheckBox_CheckedChanged;
			this.halfToLinecheckBox.Checked = this.m_printSetup.ReplaceHalftoneWithThinLines;
			if (this.m_printSetup.VerifyRevitEdition(2014))
			{
				this.regionCheckBox.Checked = false;
				this.regionCheckBox.Enabled = false;
			}
			else
			{
				this.regionCheckBox.CheckedChanged += this.regionCheckBox_CheckedChanged;
				this.regionCheckBox.Checked = this.m_printSetup.MaskCoincidentLines;
			}
			if (!this.isInsesion())
			{
				this.saveButton.Enabled = this.isPrintSettingChanged();
				return;
			}
			this.saveButton.Enabled = false;
		}

		private void SaveData()
		{
			string tempPath = Path.GetTempPath();
			string sFullPath = tempPath + "PrintSetupForm.ini";
			FormDataIni formDataIni = new FormDataIni(sFullPath);
			string text = "打印设置名称";
			string text2 = this.printSetupsComboBox.Text;
			if (!string.IsNullOrEmpty(text))
			{
				formDataIni.WriteData("UIData", text, text2);
			}
		}

		private void ReadData()
		{
			string tempPath = Path.GetTempPath();
			string sFullPath = tempPath + "PrintSetupForm.ini";
			FormDataIni formDataIni = new FormDataIni(sFullPath);
			string sKey = "打印设置名称";
			string text = formDataIni.ReadData("UIData", sKey, "");
			if (!string.IsNullOrEmpty(text) && !string.IsNullOrWhiteSpace(text) && PrintSettingManager.IsPrintSettingValid(text, this.m_printSetup.m_doc))
			{
				this.m_printSetup.SettingName = text;
			}
		}

		private void saveButton_Click(object sender, EventArgs e)
		{
			if (this.m_printSetup.Save())
			{
				this.saveButton.Enabled = false;
				PrintParameters printParameters = this.m_printSetup.getRvtPrintManger().PrintSetup.CurrentPrintSetting.PrintParameters;
				PrintSetupForm.m_RcdSetting.reSetValues(printParameters);
			}
		}

		private void printSetupsComboBox_SelectedValueChanged(object sender, EventArgs e)
		{
			if (this.m_stopUpdateFlag)
			{
				return;
			}
			this.m_printSetup.SettingName = (this.printSetupsComboBox.SelectedItem as string);
			this.paperSizeComboBox.SelectedItem = this.m_printSetup.PaperSize;
			this.paperSourceComboBox.SelectedItem = this.m_printSetup.PaperSource;
            if ((int)this.m_printSetup.PageOrientation == 1)
			{
				this.landscapeRadioButton.Checked = true;
			}
			else
			{
				this.portraitRadioButton.Checked = true;
			}
			if (this.m_printSetup.PaperPlacement == null)
			{
				this.centerRadioButton.Checked = true;
			}
			else
			{
				this.offsetRadioButton.Checked = true;
			}
			if (this.m_printSetup.VerifyMarginType(this.marginTypeComboBox))
			{
				this.marginTypeComboBox.SelectedItem = this.m_printSetup.SelectedMarginType;
			}
            if (this.m_printSetup.HiddenLineViews == (HiddenLineViewsType)1)
			{
				this.rasterRadioButton.Checked = true;
			}
			else
			{
				this.vectorRadioButton.Checked = true;
			}
            if (this.m_printSetup.ZoomType == (ZoomType)1)
			{
				this.zoomRadioButton.Checked = true;
				this.zoomPercentNumericUpDown.Value = this.m_printSetup.Zoom;
			}
			else
			{
				this.fitToPageRadioButton.Checked = true;
                this.m_printSetup.ZoomType = (ZoomType)1;
				this.zoomPercentNumericUpDown.Value = this.m_printSetup.Zoom;
				this.m_printSetup.ZoomType = 0;
			}
			this.rasterQualityComboBox.SelectedItem = this.m_printSetup.RasterQuality;
			this.colorsComboBox.SelectedItem = this.m_printSetup.Color;
			this.ViewLinksInBlueCheckBox.Checked = this.m_printSetup.ViewLinksinBlue;
			this.hideScopeBoxedCheckBox.Checked = this.m_printSetup.HideScopeBoxes;
			this.hideRefWorkPlanesCheckBox.Checked = this.m_printSetup.HideReforWorkPlanes;
			this.hideCropBoundariesCheckBox.Checked = this.m_printSetup.HideCropBoundaries;
			this.hideUnreferencedViewTagsCheckBox.Checked = this.m_printSetup.HideUnreferencedViewTags;
			this.renameButton.Enabled = (this.deleteButton.Enabled = (this.m_printSetup.SettingName.Equals("<在任务中>") ? false : true));
			this.revertButton.Enabled = (this.saveButton.Enabled = false);
			if (this.m_printSetup.SettingName.Equals("HYPrintSetting"))
			{
				this.centerRadioButton.Checked = true;
				this.offsetRadioButton.Enabled = false;
				this.zoomPercentNumericUpDown.Enabled = false;
				this.fitToPageRadioButton.Enabled = false;
				this.marginTypeComboBox.Enabled = false;
				return;
			}
			this.offsetRadioButton.Enabled = true;
			this.zoomPercentNumericUpDown.Enabled = true;
			this.fitToPageRadioButton.Enabled = true;
			this.marginTypeComboBox.Enabled = true;
			if (this.centerRadioButton.Checked)
			{
				this.marginTypeComboBox.Enabled = false;
			}
		}

		private void sizeComboBox_SelectedValueChanged(object sender, EventArgs e)
		{
			this.m_printSetup.PaperSize = (this.paperSizeComboBox.SelectedItem as string);
			if (!this.revertButton.Enabled)
			{
				this.revertButton.Enabled = true;
			}
			if (!this.isInsesion())
			{
				this.saveButton.Enabled = this.isPrintSettingChanged();
				return;
			}
			this.saveButton.Enabled = false;
		}

		private void sourceComboBox_SelectedValueChanged(object sender, EventArgs e)
		{
			this.m_printSetup.PaperSource = (this.paperSourceComboBox.SelectedItem as string);
			if (!this.revertButton.Enabled)
			{
				this.revertButton.Enabled = true;
			}
		}

		private void portraitRadioButton_CheckedChanged(object sender, EventArgs e)
		{
			if (this.portraitRadioButton.Checked)
			{
				this.m_printSetup.PageOrientation = 0;
				this.pictureBoxDirection.Image = YJKBatchPrinter.Properties.Resources.Vertical;
			}
			if (!this.revertButton.Enabled)
			{
				this.revertButton.Enabled = true;
			}
			this.enabeSaveButton();
		}

		private void landscapeRadioButton_CheckedChanged(object sender, EventArgs e)
		{
			if (this.landscapeRadioButton.Checked)
			{
                this.m_printSetup.PageOrientation = (PageOrientationType)1;
				this.pictureBoxDirection.Image = YJKBatchPrinter.Properties.Resources.Horizontal;
			}
			if (!this.revertButton.Enabled)
			{
				this.revertButton.Enabled = true;
			}
			this.enabeSaveButton();
		}

		private void centerRadioButton_CheckedChanged(object sender, EventArgs e)
		{
			if (!this.centerRadioButton.Checked)
			{
				return;
			}
			this.m_printSetup.PaperPlacement = 0;
			this.m_printSetup.VerifyMarginType(this.marginTypeComboBox);
			this.userDefinedMarginXTextBox.Enabled = false;
			this.userDefinedMarginYTextBox.Enabled = false;
			if (!this.revertButton.Enabled)
			{
				this.revertButton.Enabled = true;
			}
			this.enabeSaveButton();
		}

		private void offsetRadioButton_CheckedChanged(object sender, EventArgs e)
		{
			if (!this.offsetRadioButton.Checked)
			{
				return;
			}
            this.m_printSetup.PaperPlacement = (PaperPlacementType)1;
			this.m_printSetup.VerifyMarginType(this.marginTypeComboBox);
			Collection<System.Windows.Forms.Control> collection = new Collection<System.Windows.Forms.Control>();
			collection.Add(this.userDefinedMarginXTextBox);
			collection.Add(this.userDefinedMarginYTextBox);
			if (this.m_printSetup.VerifyUserDefinedMargin(collection))
			{
				this.userDefinedMarginXTextBox.Text = this.m_printSetup.UserDefinedMarginX.ToString();
				this.userDefinedMarginYTextBox.Text = this.m_printSetup.UserDefinedMarginY.ToString();
				if (!this.revertButton.Enabled)
				{
					this.revertButton.Enabled = true;
				}
				this.enabeSaveButton();
			}
		}

		private void marginTypeComboBox_SelectedValueChanged(object sender, EventArgs e)
		{
			this.m_printSetup.SelectedMarginType = this.m_printSetup.strToMarginType(this.marginTypeComboBox.SelectedItem.ToString());
			Collection<System.Windows.Forms.Control> collection = new Collection<System.Windows.Forms.Control>();
			collection.Add(this.userDefinedMarginXTextBox);
			collection.Add(this.userDefinedMarginYTextBox);
			if (this.m_printSetup.VerifyUserDefinedMargin(collection))
			{
				this.userDefinedMarginXTextBox.Text = this.m_printSetup.UserDefinedMarginX.ToString();
				this.userDefinedMarginYTextBox.Text = this.m_printSetup.UserDefinedMarginY.ToString();
			}
			if (!this.revertButton.Enabled)
			{
				this.revertButton.Enabled = true;
			}
			this.enabeSaveButton();
		}

		private void vectorRadioButton_CheckedChanged(object sender, EventArgs e)
		{
			if (this.vectorRadioButton.Checked)
			{
				this.m_printSetup.HiddenLineViews = 0;
				if (!this.revertButton.Enabled)
				{
					this.revertButton.Enabled = true;
				}
				this.enabeSaveButton();
				this.regionCheckBox.Enabled = !this.regionCheckBox.Enabled;
			}
		}

		private void rasterRadioButton_CheckedChanged(object sender, EventArgs e)
		{
			if (this.rasterRadioButton.Checked)
			{
                this.m_printSetup.HiddenLineViews = (HiddenLineViewsType)1;
				if (!this.revertButton.Enabled)
				{
					this.revertButton.Enabled = true;
				}
				this.enabeSaveButton();
				this.regionCheckBox.Enabled = !this.regionCheckBox.Enabled;
			}
		}

		private void fitToPageRadioButton_CheckedChanged(object sender, EventArgs e)
		{
			if (this.fitToPageRadioButton.Checked)
			{
				this.m_printSetup.ZoomType = 0;
				this.centerRadioButton.Checked = true;
				if (!this.revertButton.Enabled)
				{
					this.revertButton.Enabled = true;
				}
				this.enabeSaveButton();
			}
		}

		private void zoomRadioButton_CheckedChanged(object sender, EventArgs e)
		{
			if (this.zoomRadioButton.Checked)
			{
                this.m_printSetup.ZoomType = (ZoomType)1;
				this.offsetRadioButton.Checked = true;
				this.m_printSetup.Zoom = (int)this.zoomPercentNumericUpDown.Value;
				if (!this.revertButton.Enabled)
				{
					this.revertButton.Enabled = true;
				}
				this.enabeSaveButton();
			}
		}

		private void zoomPercentNumericUpDown_ValueChanged(object sender, EventArgs e)
		{
			if (this.zoomRadioButton.Checked)
			{
				this.m_printSetup.Zoom = (int)this.zoomPercentNumericUpDown.Value;
				if (!this.revertButton.Enabled)
				{
					this.revertButton.Enabled = true;
				}
				this.enabeSaveButton();
			}
		}

		private void rasterQualityComboBox_SelectedValueChanged(object sender, EventArgs e)
		{
			this.m_printSetup.RasterQuality = this.m_printSetup.strToRasterQualityType(this.rasterQualityComboBox.SelectedItem.ToString());
			if (!this.revertButton.Enabled)
			{
				this.revertButton.Enabled = true;
			}
			this.enabeSaveButton();
		}

		private void colorsComboBox_SelectedValueChanged(object sender, EventArgs e)
		{
			this.m_printSetup.Color = this.m_printSetup.strToColorType(this.colorsComboBox.SelectedItem.ToString());
			if (!this.revertButton.Enabled)
			{
				this.revertButton.Enabled = true;
			}
			this.enabeSaveButton();
		}

		private void ViewLinksInBlueCheckBox_CheckedChanged(object sender, EventArgs e)
		{
			this.m_printSetup.ViewLinksinBlue = this.ViewLinksInBlueCheckBox.Checked;
			if (!this.revertButton.Enabled)
			{
				this.revertButton.Enabled = true;
			}
		}

		private void hideScopeBoxedCheckBox_CheckedChanged(object sender, EventArgs e)
		{
			this.m_printSetup.HideScopeBoxes = this.hideScopeBoxedCheckBox.Checked;
			if (!this.revertButton.Enabled)
			{
				this.revertButton.Enabled = true;
			}
		}

		private void hideRefWorkPlanesCheckBox_CheckedChanged(object sender, EventArgs e)
		{
			this.m_printSetup.HideReforWorkPlanes = this.hideRefWorkPlanesCheckBox.Checked;
			if (!this.revertButton.Enabled)
			{
				this.revertButton.Enabled = true;
			}
		}

		private void hideCropBoundariesCheckBox_CheckedChanged(object sender, EventArgs e)
		{
			this.m_printSetup.HideCropBoundaries = this.hideCropBoundariesCheckBox.Checked;
			if (!this.revertButton.Enabled)
			{
				this.revertButton.Enabled = true;
			}
		}

		private void hideUnreferencedViewTagsCheckBox_CheckedChanged(object sender, EventArgs e)
		{
			this.m_printSetup.HideUnreferencedViewTags = this.hideUnreferencedViewTagsCheckBox.Checked;
			if (!this.revertButton.Enabled)
			{
				this.revertButton.Enabled = true;
			}
		}

		private void halfToLinecheckBox_CheckedChanged(object sender, EventArgs e)
		{
			this.m_printSetup.ReplaceHalftoneWithThinLines = this.halfToLinecheckBox.Checked;
			if (!this.revertButton.Enabled)
			{
				this.revertButton.Enabled = true;
			}
		}

		private void regionCheckBox_CheckedChanged(object sender, EventArgs e)
		{
			this.m_printSetup.MaskCoincidentLines = this.halfToLinecheckBox.Checked;
			if (!this.revertButton.Enabled)
			{
				this.revertButton.Enabled = true;
			}
		}

		private void userDefinedMarginXTextBox_TextChanged(object sender, EventArgs e)
		{
			double userDefinedMarginX;
			if (!double.TryParse(this.userDefinedMarginXTextBox.Text, out userDefinedMarginX))
			{
				PrintMgr.MyMessageBox("Invalid input");
				return;
			}
			this.m_printSetup.UserDefinedMarginX = userDefinedMarginX;
			if (!this.revertButton.Enabled)
			{
				this.revertButton.Enabled = true;
			}
		}

		private void userDefinedMarginYTextBox_TextChanged(object sender, EventArgs e)
		{
			double userDefinedMarginY;
			if (!double.TryParse(this.userDefinedMarginYTextBox.Text, out userDefinedMarginY))
			{
				PrintMgr.MyMessageBox("Invalid input");
				return;
			}
			this.m_printSetup.UserDefinedMarginY = userDefinedMarginY;
			if (!this.revertButton.Enabled)
			{
				this.revertButton.Enabled = true;
			}
		}

		private void saveAsButton_Click(object sender, EventArgs e)
		{
			using (SaveAsForm saveAsForm = new SaveAsForm(this.m_printSetup))
			{
				saveAsForm.ShowDialog();
			}
			this.m_stopUpdateFlag = true;
			this.printSetupsComboBox.DataSource = this.m_printSetup.PrintSettingNames;
			this.printSetupsComboBox.Update();
			this.m_stopUpdateFlag = false;
			this.printSetupsComboBox.SelectedItem = this.m_printSetup.SettingName;
			PrintParameters printParameters = this.m_printSetup.getRvtPrintManger().PrintSetup.CurrentPrintSetting.PrintParameters;
			PrintSetupForm.m_RcdSetting.reSetValues(printParameters);
		}

		private void renameButton_Click(object sender, EventArgs e)
		{
			using (ReNameForm reNameForm = new ReNameForm(this.m_printSetup))
			{
				reNameForm.ShowDialog();
			}
			this.m_stopUpdateFlag = true;
			this.printSetupsComboBox.DataSource = this.m_printSetup.PrintSettingNames;
			this.printSetupsComboBox.Update();
			this.m_stopUpdateFlag = false;
			this.printSetupsComboBox.SelectedItem = this.m_printSetup.SettingName;
		}

		private void revertButton_Click(object sender, EventArgs e)
		{
			this.m_printSetup.Revert();
			this.printSetupsComboBox_SelectedValueChanged(null, null);
		}

		private void deleteButton_Click(object sender, EventArgs e)
		{
			SubTransaction subTransaction = new SubTransaction(this.m_printSetup.m_doc);
			subTransaction.Start();
			if (this.m_printSetup.Delete())
			{
				subTransaction.Commit();
			}
			else
			{
				subTransaction.RollBack();
			}
			this.m_stopUpdateFlag = true;
			this.printSetupsComboBox.DataSource = this.m_printSetup.PrintSettingNames;
			this.printSetupsComboBox.Update();
			this.m_stopUpdateFlag = false;
			this.printSetupsComboBox.SelectedItem = this.m_printSetup.SettingName;
		}

		private void PrintSetupForm_FormClosing(object sender, FormClosingEventArgs e)
		{
			if (DialogResult.Cancel == base.DialogResult)
			{
				return;
			}
			this.SaveData();
		}

		private bool isInsesion()
		{
			return this.m_printSetup.SettingName.Equals("<在任务中>");
		}

		private void enabeSaveButton()
		{
			if (!this.isInsesion())
			{
				this.saveButton.Enabled = this.isPrintSettingChanged();
				return;
			}
			this.saveButton.Enabled = false;
		}

		private void zoomPercentNumericUpDown_KeyUp(object sender, KeyEventArgs e)
		{
			this.saveButton.Enabled = true;
		}

		private bool isPrintSettingChanged()
		{
			this.m_printSetup.getRvtPrintManger();
			PrintParameters printParameters = this.m_printSetup.getRvtPrintManger().PrintSetup.CurrentPrintSetting.PrintParameters;
			bool flag = PrintSetupForm.m_RcdSetting.isEqual(printParameters);
			return !flag;
		}

		private void okButton_Click(object sender, EventArgs e)
		{
			if (this.saveButton.Enabled)
			{
				DialogResult dialogResult = YJKMessageBox.Show("是否保存修改的数据", MessageBoxButtons.OKCancel);
				if (dialogResult == DialogResult.OK)
				{
					this.saveButton_Click(sender, e);
				}
			}
		}

		private PrintSTP m_printSetup;

		private bool m_stopUpdateFlag;

		private static PrintSetupForm.printSettingDlg m_RcdSetting;

		private class printSettingDlg
		{
			public bool isZoomEqual(PrintParameters param)
			{
				bool result = false;
				if (param.ZoomType == null)
				{
					if (this.ZoomType == param.ZoomType)
					{
						result = true;
					}
				}
                else if ((int)param.ZoomType == 1 && this.ZoomType == param.ZoomType && this.Zoom == param.Zoom)
				{
					result = true;
				}
				return result;
			}

			public bool isEqual(PrintParameters param)
			{
				bool result = false;
				if (this.ColorDepth == param.ColorDepth && this.HiddenLineViews == param.HiddenLineViews && this.HideCropBoundaries == param.HideCropBoundaries && this.HideReforWorkPlanes == param.HideReforWorkPlanes && this.HideScopeBoxes == param.HideScopeBoxes && this.HideUnreferencedViewTags == param.HideUnreferencedViewTags && this.MarginType == param.MarginType && this.PageOrientation == param.PageOrientation && this.PaperPlacement == param.PaperPlacement && this.PaperSize.Name.Equals(param.PaperSize.Name) && this.PaperSource.Name.Equals(param.PaperSource.Name) && this.RasterQuality == param.RasterQuality && this.ReplaceHalftoneWithThinLines == param.ReplaceHalftoneWithThinLines && this.ViewLinksinBlue == param.ViewLinksinBlue && this.isZoomEqual(param))
				{
					result = true;
				}
				return result;
			}

			public void reSetValues(PrintParameters param)
			{
				this.ColorDepth = param.ColorDepth;
				this.HiddenLineViews = param.HiddenLineViews;
				this.HideCropBoundaries = param.HideCropBoundaries;
				this.HideReforWorkPlanes = param.HideReforWorkPlanes;
				this.HideScopeBoxes = param.HideScopeBoxes;
				this.HideUnreferencedViewTags = param.HideUnreferencedViewTags;
				this.MarginType = param.MarginType;
				this.PageOrientation = param.PageOrientation;
				this.PaperPlacement = param.PaperPlacement;
				this.PaperSize = param.PaperSize;
				this.PaperSource = param.PaperSource;
				this.RasterQuality = param.RasterQuality;
				this.ReplaceHalftoneWithThinLines = param.ReplaceHalftoneWithThinLines;
				this.ViewLinksinBlue = param.ViewLinksinBlue;
				this.ZoomType = param.ZoomType;
                if ((int)this.ZoomType == 1)
				{
					this.Zoom = param.Zoom;
				}
			}

			public ColorDepthType ColorDepth { get; set; }

			public HiddenLineViewsType HiddenLineViews { get; set; }

			public bool HideCropBoundaries { get; set; }

			public bool HideReforWorkPlanes { get; set; }

			public bool HideScopeBoxes { get; set; }

			public bool HideUnreferencedViewTags { get; set; }

			public MarginType MarginType { get; set; }

			public PageOrientationType PageOrientation { get; set; }

			public PaperPlacementType PaperPlacement { get; set; }

			public PaperSize PaperSize { get; set; }

			public PaperSource PaperSource { get; set; }

			public RasterQualityType RasterQuality { get; set; }

			public bool ReplaceHalftoneWithThinLines { get; set; }

			public bool ViewLinksinBlue { get; set; }

			public int Zoom { get; set; }

			public ZoomType ZoomType { get; set; }
		}
	}
}
